package com.wf.classRoomTest.run; /**
 * @author mpk
 * @since  2024/6/11 15:49:10
 */
public class ThreadTest {
    public static void main(String[] args) {

//子任务
        Thread thread = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                Thread m = Thread.currentThread();
                System.out.println(m.getName()+"1输出"+i);
            }
        }, "son");

        Thread thread1 = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                Thread m = Thread.currentThread();
                System.out.println(m.getName()+"2输出"+i);
            }
        }, "son");

        Thread thread2 = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                Thread m = Thread.currentThread();
                System.out.println(m.getName()+"3输出"+i);
            }
        }, "son");
        Thread thread3 = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                Thread m = Thread.currentThread();
                System.out.println(m.getName()+"4输出"+i);
            }
        }, "son");
        Thread thread4 = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                Thread m = Thread.currentThread();
                System.out.println(m.getName()+"5输出"+i);
            }
        }, "son");

        thread.start();
        thread1.start();
        thread2.start();
        thread3.start();
        thread4.start();

        //主任务
        Thread t= Thread.currentThread();
        for (int i = 0; i < 3; i++) {
            System.out.println(t.getName() + "线程输入：" + i);
        }
    }



}
